#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Zhangcl
import queue
import threading
import time
q =queue.Queue(maxsize=10)

def sc():
    count = 1
    while True:
        q.put('包子%s' %count)
        print('生产了包子%s' %count)
        count += 1
        #time.sleep(1)
def xf(name):
    while True:
        print('%s 吃到了%s' %(name,q.get()))
        time.sleep(2)

p = threading.Thread(target=sc)
c = threading.Thread(target=xf,args=('A',))
c1 = threading.Thread(target=xf,args=('B',))
p.start()
c.start()
c1.start()